package com.css.apps.base.sysjob.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.css.apps.base.common.provider.json.OrgJsonProvider;
import com.css.core.configuration.Environment;
import com.css.util.Ajax;
import com.css.util.Messages;
import com.css.webbase.webwork.action.AdminAction;
import com.opensymphony.xwork.Action;

import net.sf.json.JSONArray;

public class DirOrgJob extends AdminAction{
	private static final long serialVersionUID = 3360068311021607284L;
	private static Log log = LogFactory.getLog(DirOrgJob.class);
	private String orgId;
	private String upperTrees;
	@Override
	protected String adminGo() {
		try {
			JSONArray orgTree = new JSONArray();
			OrgJsonProvider json = new OrgJsonProvider();
			orgTree = json.getOrgPostTree(orgId);
			result = orgTree.toString();
			upperTrees = orgTree.toString();
			return Action.SUCCESS;
		} catch (Exception ex) {
			result = Ajax.JSONResult(Environment.RESULT_CODE_ERROR, Messages.getString("systemMsg.exception"));
			log.error(ex.getMessage(), ex);
			return Action.ERROR;
		}
	}

	public String getOrgId() {
		return orgId;
	}

	public void setOrgId(String orgId) {
		this.orgId = orgId;
	}

	public String getUpperTrees() {
		return upperTrees;
	}

	public void setUpperTrees(String upperTrees) {
		this.upperTrees = upperTrees;
	}
}